use std::{env::{self}, process};
use minigrep_copy::Config;

fn main() {
    // for i in 12..15  {
    //     println!("{i}");
    // }

    //let buffer = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
    // let stand = 12;
    // let i = 15;
    // let part = &buffer[i - stand..i];
    // for cc in part  {
    //     println!("{cc}");
    //}

    // let buffer1 = [1,2,3];
    // let data2 = [2,3,4];
    // let sumabc: i64 = buffer1.iter().zip(&data2).map(|(&c, &s)| {
    //     println!(" {c}  {s} ");    
    //     c * s as i64
    // }).sum();
    // print!("aabbcc  {sumabc}")

    let config = Config::build(env::args()).unwrap_or_else(|err| {
        eprintln!("Problem parsing arguments: {err}");
        process::exit(1);
    });
    
    if let Err(e) = minigrep_copy::run(config) {
        eprintln!("Application error:{e}");
        process::exit(1);
    }
}
